//1.引入Vue
import Vue from "vue";

//2.引入Vue-Router
import VueRouter from "vue-router";

//使用Router插件
Vue.use(VueRouter);

//引入路由组件
import Home from "../pages/Home/Home.vue";
import Login from "../pages/Login/Login.vue";
import Music from '../pages/Home/Music';
import News from '../pages/Home/News';
import Games from '../pages/Home/Games'

export default new VueRouter({
  routes: [
    { path: "/login", component: Login ,name : 'login'},
    { 
        path: "/home",
        component: Home,
        children:[
            {path: "music/:id", component: Music ,name : 'music',props:true},
            {path: "news", component: News ,name : 'news'},
            {path: "games", component: Games ,
            // props:{
            //     a:1,
            //     b:2
            // },
            props:(route)=>{
                return route.query;
            }
        },
            {path:'' , redirect:"/home/news"}
        ]
     },
     {path:"/", redirect:"/home"}
  ],
});
